#ifndef _np_singleton
#define _np_singleton

template<class T>
class Singleton{
private:
	static T* the_singleton;
public:
	Singleton(){
		assert(the_singleton==NULL);
		the_singleton = reinterpret_cast<T*>(this);
	};

	virtual ~Singleton(){
		assert(the_singleton!=NULL);
		the_singleton = NULL;
	};

	inline static T* get_singleton(){
		return the_singleton;
	};
};
template<class T>
T* Singleton<T>::the_singleton = NULL;


#endif //#ifndef _np_singleton
